
def coundownFrom(n):
    if n>0:
        coundownFrom(n-1)
    print(n)

def findNum(lst, a, b, num):
    if num in lst:
        middle = int((a + b) / 2)
        if lst[middle] == num:
            return '输入数字在列表中的索引是%d' % middle
        elif lst[middle] < num:
            return findNum(lst, middle, b, num)
        else:
            return findNum(lst, 0, middle, num)
    else:
        return None
def f(n):
    if n>0:
        return n*f(n-1)
    else:
        return 1

# 动态规划
def Feibonacci1(n):
    array = [0, 1]
    while len(array) <= n:
        array.append(array[-1]+array[-2])
    return array[n]


# 递归
def Fibonacci(n):
    if(n <= 2):
        return 1
    else:
        return Fibonacci(n-1)+Fibonacci(n-2)

if __name__ == '__main__':
    print(f(3))
    # 随机定义一个有序列表
    lst1 = [1, 5, 8, 12, 26, 45, 86, 112, 258, 598, 698]
    num1 = int(input('请列表中输入一个数字:'))
    # 调用函数并输出
    print(findNum(lst1, 0, len(lst1), num1))
